package org.future.esb;
/**
 *@date   2010-4-12 下午01:41:24
 *@author dycc
 *@file   org.future.esb.Service.java
 */
public class Service {
	private String tagName = "service";
	private String name = "";
	private String description = "";
	private Inbound inbound = null;
	private Component component = null;
	private Outbound outbound = null;
	/**
	 * 校验
	 * @return
	 */
	public boolean validate(){
		boolean result = true;
		if(name == null || name.trim().equals("")){
			return false;
		}
		return result;
	}
	/**
	 * toString
	 */
	public String toString(){
		StringBuilder sb = new StringBuilder();
		sb.append("<" + tagName);
		if(!"".equals(name)){
			sb.append(" name=\"" + getName() + "\"");
		}
		sb.append(">");
		sb.append("\r\n");
		// add childs
		if(!"".equals(getDescription())){
			sb.append("<description>" + getDescription() + "</description>");
			sb.append("\r\n");
		}
		sb.append(getInbound());
		sb.append("\r\n");
		// add end element
		sb.append("</" + tagName + ">");
		return sb.toString();
	}
	
	public String getName() {
	    return name;
    }
	public void setName(String name) {
	    this.name = name;
    }
	
	public String getDescription() {
	    return description;
    }
	public void setDescription(String description) {
	    this.description = description;
    }
	
	public Inbound getInbound() {
	    return inbound;
    }
	public void setInbound(Inbound inbound) {
	    this.inbound = inbound;
    }
	
	public Component getComponent() {
	    return component;
    }
	public void setComponent(Component component) {
	    this.component = component;
    }
	
	public Outbound getOutbound() {
	    return outbound;
    }
	public void setOutbound(Outbound outbound) {
	    this.outbound = outbound;
    }
}
